﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

namespace HY.BLL.ba
{
    public class barea
    {
        public static DataTable get_list(string ty)
        {
            string sqltxt = "select * from base_area  where stype='"+ty+"'  ";

            sqltxt = sqltxt + " order by sid desc ";
            DataTable dt = DAL.DbHelperSQL.SqlDataAdapter(sqltxt);
            return dt;
        }



        public static DataTable get_list(string ty,string whe)
        {
            string sqltxt = "select * from base_area where  stype='" + ty + "'    ";
            if (whe != "") sqltxt = sqltxt + " and " + whe;

            sqltxt = sqltxt + " order by sid desc ";
            DataTable dt = DAL.DbHelperSQL.SqlDataAdapter(sqltxt);
            return dt;
        }


        public static int ins_task(string title, string contont, string stype)
        {
            string sqltxt = "insert into base_area values(N'" + title + "',N'" + contont + "',N'" + stype + "')  ";
            return DAL.DbHelperSQL.ExecuteNonQuery(sqltxt);
        }

        public static int ups_task(string sid, string title, string contont, string stype)
        {
            string sqltxt = "update base_area set title=N'" + title + "',contont=N'" + contont + "',stype=N'" + stype + "' where sid=" + sid + ")  ";
            return DAL.DbHelperSQL.ExecuteNonQuery(sqltxt);

        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public static int DeleteList(string sidlist)
        {
            string sqltxt = "delete base_area where sid in(" + sidlist + ") ";
            return DAL.DbHelperSQL.ExecuteNonQuery(sqltxt);
        }
    }
}
